#pragma once

#include <string>
#include "ShaderProgram.h"
#include "glm/glm.hpp"

using namespace glm;
using namespace std;

class CoordinateSystemShader : public ShaderProgram
{
  public:
    CoordinateSystemShader();
    CoordinateSystemShader(const string& vertexShaderSource,
                           const string& fragmentShaderSource);
    unsigned int createShaderProgram() override;

    void update() override;

  protected:
    /**
    * 创建模型矩阵，把物体从本地坐标搬运到世界坐标系中的某个位置
    The coordinates of your object are transformed from local to world space;
    this is accomplished with the model matrix.
    */
    virtual mat4 createModelMatrix();

    /* 转换为摄像机视角
    The view space is the result of transforming your world-space coordinates to
    coordinates that are in front of the user's view. The view space is thus the
    space as seen from the camera's point of view. This is usually accomplished
    with a combination of translations and rotations to translate/rotate the
    scene so that certain items are transformed to the front of the camera.
    These combined transformations are generally stored inside a view matrix
    that transforms world coordinates to view space.
    */
    virtual mat4 createViewMatrix();

    mat4 createClipSpace() { return createPerspectiveProjection(); }

    /**
        创建透视投影矩阵
        实现近大远小效果
    */
    mat4 createPerspectiveProjection();

    int modelMatrixLocation;
    int viewMatrixLocation;
    int projectionMatrixLocation;
};